package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqOtherFeeLastThree;
import com.ruoyi.hqfinance.domain.HqOtherFeeShortBargeFee;
import com.ruoyi.hqfinance.domain.vo.HqOtherFeeLastThreeVo;
import com.ruoyi.hqfinance.domain.vo.HqOtherFeeShortBargeFeeVo;
import com.ruoyi.hqfinance.mapper.HqOtherFeeLastThreeMapper;
import com.ruoyi.hqfinance.mapper.HqOtherFeeShortBargeFeeMapper;
import com.ruoyi.hqfinance.service.HqOtherFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqOtherFeeServiceImpl implements HqOtherFeeService {
    @Autowired
    private HqOtherFeeShortBargeFeeMapper hqOtherFeeShortBargeFeeMapper;
    @Autowired
    private HqOtherFeeLastThreeMapper hqOtherFeeLastThreeMapper;
      @Override
    public List<HqOtherFeeShortBargeFee> collectBargeFee(HqOtherFeeShortBargeFeeVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqOtherFeeShortBargeFee> shortBargeFees = hqOtherFeeShortBargeFeeMapper.collectBargeFee(vo);
        assert shortBargeFees != null;
        for (HqOtherFeeShortBargeFee hqOtherFeeShortBargeFee : shortBargeFees){
            hqOtherFeeShortBargeFee.setCollectDate(vo.getStartTime() + "至" + vo.getEndTime());
        }
        return shortBargeFees;
    }

    @Override
    public List<HqOtherFeeLastThree> collectLastThree(HqOtherFeeLastThreeVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqOtherFeeLastThree> lastThrees = hqOtherFeeLastThreeMapper.collectLastThree(vo);
        assert lastThrees != null;
        for (HqOtherFeeLastThree hqOtherFeeLastThree : lastThrees){
            hqOtherFeeLastThree.setCollectDate(vo.getStartTime() + "至" + vo.getEndTime());
        }
        return lastThrees;
    }

}
